<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2017/10/27
  Time: 16:10
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<link href="${js}/validate/validation.css" rel="stylesheet" type="text/css"/>
<script src="${js}/validate/jquery.validate.min.js"></script>
<script src="${js}/validate/messages_zh.min.js"></script>
<script src="${js}/validate/validate.extend.js"></script>
<script type="text/javascript" charset="utf-8" src="${js}/plupload-2.1.2/js/plupload.full.min.js"></script>
<script type="text/javascript" charset="utf-8" src="${js}/qiniu/qiniu.min.js"></script>
<script type="text/javascript" charset="utf-8" src="${js}/qiniu/Qiniu.config.js"></script>
<style>
    .image_result {
        text-align: center;
        height: 100px;
        padding-left: 70px;
        margin: 10px;
        overflow-y: auto;
    }

    .image_result img {
        height: 95%;
        margin-left: 5px;
    }

    #pickfiles {
        position: absolute;
        z-index: 1;
        padding: 5px;
        background: #18ae81;
        color: #fff;
        top: 45px;
    }
</style>
<script type="text/javascript">
    $(function () {
        $("#form").validate({
            rules: {
                name: {
                    required: true,
                    maxlength: 20
                }
            }
        });


        // 初始化文件上传控件
        init_uploader({
            uptoken: qiniuyun_upload_token,
            domain: qiniuyun_upload_domain,
            fileUploaded: function (filePath) {
                replaceImage(filePath);
                $("#form").valid()
            }
        });
        function replaceImage(url) {
            $('.image_result').empty();
            var img = document.createElement("img");
            img.src = url;
            $('.image_result').append(img);
            $("#icon").val(url);
        }
    });
</script>